package br.com.perkins.myproject.service.exception;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

@Service
@Scope("prototype")
public class ServiceException extends RuntimeException {

	@Resource
	private ServiceExceptionMessageService serviceExceptionMessageService;

	private final Map<Integer, String> serviceExceptions = new HashMap<Integer, String>();
	public void setServiceException(Integer exceptionNumber) {
		serviceExceptions.put(exceptionNumber, serviceExceptionMessageService.getServiceException(exceptionNumber));
	}
	public Map<Integer, String> getServiceExceptions() {
		return serviceExceptions;
	}

	public void newErrorSession() {
		serviceExceptions.clear();
	}

}